package com.ben.multiple.minio;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author BenJin Yin
 * @date 2020/5/7
 */
@RequestMapping("/min")
@AllArgsConstructor
@RestController
public class TestRest {
    private final MinioService minioService;

    @GetMapping("/simple")
    public String simple() {
        minioService.te();
        return "ok";
    }

    @PostMapping("/common")
    public String common(@RequestParam(value = "file") MultipartFile file) throws IOException {
        minioService.common(file.getInputStream());
        return "ok";
    }
}
